<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <button id="s">开始</button>
    <button id="e">结束</button>
    <div>
        <span>当前进度</span>
        <span id="t">50%</span>
        <progress id="p" value="50" max="100"></progress>
    </div>
    
    <script>
        let on = document.getElementById('s');
        let off = document.getElementById('e');
        let t = document.getElementById('t');
        let p = document.getElementById('p');
        let timer = null;

        p.value = 0;
        t.innerText = '0%';

        on.onclick = function(){
            timer = setInterval(() => {
                let pval = p.value;
                pval += 1;
                if(pval>=100){
                    clearInterval(timer);
                }
                p.value = pval;
                t.innerText = pval.toString() + '%';
            }, 100);
        }
        off.onclick = function(){
            p.value = 0;
            t.innerText = '0%';
            clearInterval(timer);
        }
    </script>
</body>
</html>